Byte endianess is an attribute of data storage and retrieval. Big endian data may be stored in memory in opposite byte order from little endian data. Little endian data may be stored with the least significant byte in the lowest memory byte address while big endian data may be stored with the most significant byte in the lowest memory byte address. Big and little endian variables having the same value are identical in CPU registers but may have differing order in memory.
Source code that is written using one byte endianess convention may not be executed on a platform using another endianess convention without recognizing the differing order of how some data are stored in memory. For example, it may be desirable to preserve endian byte ordering within data written to or read from outside a program.
Endian conversion, which may be performed using several techniques, may be used to execute code written in one endianess convention on a computer system platform of another endianess convention. First, a programmer may use a manual endian conversion technique to manually analyze code and attempt to detect where byte order dependencies exist. The programmer may then insert, for example, byteswap (i.e., endian flip) instructions to address the identified dependencies. However, it may be difficult to manually find these dependency areas. Second, with a bi-endian compiler a programmer may designate the byte order of code regions. The bi-endian compiler then automatically inserts byteswaps into a compiled executable that can execute with opposite byte order semantics. However, the use of such a unique compiler may limit the platforms to which the source code is applicable. Third, binary translation may enable execution of executables targeted to a different architecture using dynamic translation of instructions from one instruction set to another while maintaining byte order semantics. However, such translations can be slow and affect system performance.